package com.lanou3g.code0426;

import java.sql.SQLException;
import java.sql.Statement;

/**
 * Created by dllo on 18/4/26.
 */
public class Test03 {
    public static void main(String[] args) {
        String sql = "DELETE FROM stu WHERE sname = '张三';";
        Statement statement = JDBCUtil.getStatement();
        try {
            int rows = statement.executeUpdate(sql);
            if (rows > 0) {
                System.out.println("成功");
            } else {
                System.out.println("失败");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        JDBCUtil.closeResource(statement); // 关闭资源
        JDBCUtil.closeConn(); // 放在Main方法的最后一行
        // 整个项目 写这一遍 就可以了,别写太多
    }
}
